<?php

namespace app\admin\model;


use app\common\model\TimeModel;
use think\Model;

class SystemLog extends TimeModel
{

    public function __construct(array $data = [])
    {
        parent::__construct($data);
    }

    public function setMonth($month)
    {
        $this->name = 'system_log_' . $month;
        return $this;
    }

    public function showName()
    {
        return $this->name;
    }

    public function admin()
    {
        return $this->belongsTo('app\admin\model\SystemAdmin', 'admin_id', 'id');
    }


    public static function onAfterRead(Model $model)
    {
//        $model->admin_name = SystemAdmin::where('id',$model->admin_id)->value('username')??'';
//        $model->create_time = date('Y-m-d H:i:s',$model->create_time);
    }

}